package com.dzsw.redission.controller;

import com.dzsw.redission.util.RedisUtil;
import org.redisson.api.RedissonClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;

@RestController
public class CommonController {

    @Resource
    private RedisUtil redisUtil;

    @GetMapping("/test")
    public String test() {
        for (int i = 0; i < 10; i++) {
            String key = Calendar.getInstance().getTimeInMillis() + "";
            redisUtil.set(key, String.format("%s_key", i), 30);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return "ok";
    }

}
